<template>
  <el-tabs ref="compRef" v-model="value" v-bind="{ ...$props }">
    <template v-for="(_slot, slotName) in $slots" #[slotName]="slotProps">
      <slot :name="slotName" v-bind="slotProps" :key="slotName"></slot>
    </template>
  </el-tabs>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { BaseTabsExpose } from "./types";
interface Props {
  modelValue?: string | number;
  type?: "" | "card" | "border-card";
  closable?: boolean;
  addable?: boolean;
  editable?: boolean;
  topPosition?: "top" | "right" | "bottom" | "left";
  stretch?: boolean;
  beforeLeave: () => boolean;
}

/** 需要按照官网文档设置默认值，否则表现效果和官网文档的不一致 */
withDefaults(defineProps<Props>(), {
  type: "",
  topPosition: "top",
  beforeLeave: () => true,
});

const value = defineModel();
const compRef = ref();

defineExpose<BaseTabsExpose>({
  // @ts-ignore
  instance: compRef,
});
</script>
<style lang="scss"></style>
